package com.coolxiaoyao.android;

import com.coolxiaoyao.common.annotation.*;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @author Kerry on 18/09/29
 */

public class NtingAnnotationProcessor extends AbstractProcessor {

    @Override
    public synchronized void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
    }

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        return false;
    }

    @Override
    public Set<String> getSupportedAnnotationTypes() {
        Set<String> myAnnotations = new LinkedHashSet<>();
        myAnnotations.add(RestController.class.getCanonicalName());

        myAnnotations.add(GetMapping.class.getCanonicalName());
        myAnnotations.add(PostMapping.class.getCanonicalName());
        myAnnotations.add(PutMapping.class.getCanonicalName());
        myAnnotations.add(DeleteMapping.class.getCanonicalName());

        myAnnotations.add(RequestParam.class.getCanonicalName());
        myAnnotations.add(RequestBody.class.getCanonicalName());
        myAnnotations.add(PathVariable.class.getCanonicalName());

        return myAnnotations;
    }

    @Override
    public SourceVersion getSupportedSourceVersion() {
        return SourceVersion.latestSupported();
    }
}
